import 'package:flutter/material.dart';
import 'package:flutter_syt/domain/widgets/network_load_image.dart';
import 'package:flutter_syt/utils/global_date_time_format.dart';

import 'flow_item.dart';

class FlowBigItem extends StatelessWidget {
  final FlowItemEntity _entity;

  FlowBigItem(this._entity);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: [
          Stack(
            children: [
              ClipRRect(
                borderRadius: BorderRadius.all(Radius.circular(8)),
                child: AspectRatio(
                  aspectRatio: 1.78,
                  // child: CachedNetworkImage(
                  //   imageUrl: _entity.imageUrl,
                  // ),
                  child: NetworkLoadImage.loadNetworkImage(_entity.imageUrl),
                ),
              ),
              Positioned.fill(
                child: Center(
                  child: Image.asset("assets/icons/flow_play.png"),
                ),
              ),
            ],
          ),
          Text(
            _entity.text,
            maxLines: 1,
            overflow: TextOverflow.ellipsis,
            style: TextStyle(
              fontSize: 16,
              color: Colors.black.withOpacity(0.8),
            ),
          ),
          Row(
            children: [
              Container(
                color: Color(0xffFFF5E7),
                padding: EdgeInsets.symmetric(vertical: 4, horizontal: 10),
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.all(Radius.circular(8)),
                ),
                child: Text(
                  _entity.labelText,
                  style: TextStyle(
                      fontWeight: FontWeight.w600,
                      fontFamily: 'PingFang SC',
                      fontSize: 10,
                      color: Color(0xffE8692B)),
                ),
              ),
              Spacer(),
              Text(
                formatDate(_entity.createTime),
                style: TextStyle(
                    color: Colors.black.withOpacity(0.4), fontSize: 11),
              ),
            ],
          )
        ],
      ),
    );
  }
}
